/**
 * Copyright (c) 2011 eelpo.com
 * All rights reserved.
 */
package com.eelpo.cmmp.uac.dao.vo;

import java.io.Serializable;

import com.eelpo.cmmp.uac.dao.vo.enumed.Status;
import com.eelpo.common.util.BlankUtils;

/**
 * <pre>
 * 
 * 企业值对象(Value Object)
 * 
 * </pre>
 * 
 * @author <a href="mailto:Brian@eelpo.com">汪洪州</a>
 * @since 1.0
 */
public class Enterprise implements Serializable {

	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = 8153603691762880342L;

	/**
	 * 企业Id
	 */
	private String id;

	/**
	 * 企业名称
	 */
	private String name;

	/**
	 * 联系人
	 */
	private String contact;

	/**
	 * 联系电话
	 */
	private String phone;

	/**
	 * 企业状态
	 */
	private Status status;

	/**
	 * 企业的序列
	 */
	private Integer index;

	/**
	 * 企业描述信息
	 */
	private String description;

	/**
	 * 父企业
	 */
	private Enterprise parent;

	public Enterprise(Status status) {
		this.status = status;
	}

	public Enterprise() {

	}

	public Enterprise(String id) {
		this.id = id;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getContact() {
		return contact;
	}

	public void setContact(String contact) {
		this.contact = contact;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public Status getStatus() {
		return status;
	}

	public void setStatus(Status status) {
		this.status = status;
	}

	public Integer getIndex() {
		return index;
	}

	public void setIndex(Integer index) {
		this.index = index;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Enterprise getParent() {
		return parent;
	}

	public void setParent(Enterprise parent) {
		this.parent = parent;
	}

	@Override
	public boolean equals(Object obj) {
		if (BlankUtils.isBlank(obj) || !(obj instanceof Enterprise))
			return false;

		if (this == obj)
			return true;

		Enterprise enterprise = (Enterprise) obj;

		if (BlankUtils.isBlank(this.id) || BlankUtils.isBlank(enterprise.getId())) {
			return false;
		}

		return this.id.equals(enterprise.getId());
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public String toString() {
		return name;
	}
}
